<template>
	<view class="goods_list">
		<view class="two_list">
			<view
				class="goods_item"
				v-for="(i,index) in allData"
				:key="index"
				@click="goToInfo(i)"
			>
				<view class="goods_pic">
					<image :src="i.src" mode="aspectFill"></image>
					<view class="image_tag">
						精品
					</view>
				</view>
				<view class="goods_info">
					<view class="goods_title"><u--text :lines="2" :text="i.title"></u--text></view>
					<view class="goods_price">
						<view class="line_price">￥{{ i.price }}</view>
						<view class="price">
							<view class="">￥{{ i.vipPrice }}</view>
							<view class="vip_tag">会员价</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	name: 'goods-list',
	data() {
		return {
			allData: [
				{
					src: 'https://cdn.uviewui.com/uview/swiper/swiper1.png',
					title: 'supersuper超级超级大大大大大容量锂电池1000000mha',
					price: '120.00',
					vipPrice: '100.00'
				},
				{
					src: 'https://cdn.uviewui.com/uview/swiper/swiper1.png',
					title: 'super1000mha',
					price: '120.00',
					vipPrice: '100.00'
				}
			]
		};
	},
	methods:{
		goToInfo(i){
			console.log(i);
			// uni.navigateTo({
			// 	url: '/mallPage/goodsInfo/goosInfo'
			// });
			uni.navigateTo({
				url:`/mallPage/goodsInfo/goodsInfo`
			})
		}
	}
};
</script>
<style>
page {
	background-color: aliceblue;
}
</style>
<style lang="scss">
.goods_list {
	padding: 0 30rpx;
	.two_list {
		display: flex;
		flex-wrap: wrap;

		.goods_item {
			border-radius: 10rpx;
			background-color: #fff;
			height: 510rpx;
			width: 330rpx;
			margin-left: 30rpx;
			margin-bottom: 30rpx;
			&:nth-child(2n-1) {
				margin-left: 0;
			}
			.goods_pic {
				position: relative;
				image {
					width: 330rpx;
					height: 330rpx;
					border-radius: 10rpx 10rpx 0 0;
				}
				.image_tag{
					position: absolute;
					top: 0;
					background-color: #1786f8;
					border-radius: 10rpx 0 10rpx 0;
					font-size: 20rpx;
					color: #fff;
					padding:  6rpx 14rpx;
				}
			}
			.goods_info {
				padding: 10rpx 20rpx 20rpx 20rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				height:150rpx ;
				.goods_price{
					.line_price {
						text-decoration: line-through;
						font-size: 20rpx;
						color: #aaa;
					}
					.price {
						font-weight: bold;
						font-size: 28rpx;
						color: #1786f8;
						display: flex;
						.vip_tag {
							background-color: #000000;
							border-radius: 6rpx;
							font-size: 15rpx;
							padding: 0 8rpx;
							height: 28rpx;
							font-weight: normal;
							line-height: 28rpx;
							margin-top: 6rpx;
							margin-left: 10rpx;
							color: #ddda80;
							position: relative;
							z-index: 1;
							&::before {
								content: '';
								display: block;
								position: absolute;
								left: -6rpx;
								z-index: 0;
								border-top: 8rpx solid #000000;
								border-bottom: 8rpx solid transparent;
								border-left: 8rpx solid transparent;
								border-right: 8rpx solid #000000;
							}
						}
					}
					
				}

				
			}
		}
	}
}
</style>
